<!DOCTYPE html>
<html lang="en">
{include file='Public:head'}
<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<style>
</style>
<div class="am-g tpl-g">
    {include file='Public:header'}
    {include file='Public:menu2'}
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">新增商品类型</div>

                            <form form="submit" method="post"class="am-form am-form-horizontal" id="category_form">
                                <div class="am-form-group"  >
                                    <label  class="am-u-sm-4 am-form-label">商品类型</label>
                                    <div class="am-u-sm-8" >
                                        <input type="text" id="name" name="name" value="{$cat_list.name}" placeholder="类型名称" style="width:500px;" >
                                    </div>
                                </div>
                                <div class="box-footer">
                                    <input type="hidden" name="id" value="{$cat_list.id}">
                                    <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>

                                    <button type="submit"  class="am-btn am-btn-secondary" style="float: right"><i class="icon-ok"></i>提交</button>
                                </div>
                            </form>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
{include file='Public:script'}
{include file='Public:validation'}
<script>
    //提交
    function roleSubmit(){
        var form=document.getElementById("category_form");
        var formData=new FormData(form);
        $.ajax({
            url:"{:Url('commodityTypeAdd')}",
            type:'POST',
            data:formData,
            async: false,
            cache: false,
            contentType: false, //不设置内容类型
            processData: false, //不处理数据
            success:function(res){
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 2000,icon: 2});
                    return false;
                }
                layer.msg(res.msg, {shade: 0.5, time: 2000, icon: 1}, function(){
                    window.location.href=document.referrer;

                });
            }
        });

    }
</script>




</html>